﻿
//功能：移动聊天窗口
var chatWin_x = 0;
var chatWin_y = 0;//聊天窗口的left和top值
var chatWin_state = 1; //记录鼠标左键状态0:down   1:up
var TopWin = 0; //用于目标聊天窗口顶层显示
var noFollow = 1; //用于使得某些地方的拖动效果无效，如输入输出框
function FollowInit(source) {
    chatWin_state = 0;
    source.style.zIndex = TopWin++; //目标窗口放到最上
    chatWin_x = event.offsetX;
    chatWin_y = event.offsetY;
}

function Follow(source) {
    if (chatWin_state == 0&&noFollow == 1) {
        source.style.position = "absolute";
        source.style.left = event.clientX - chatWin_x;
        source.style.top = event.clientY - chatWin_y;
    }
}

function FollowEnd(source) {
    chatWin_state = 1;
}
function NoFollow(source) {
noFollow = 0;
}
function CanFollow(source) {
    noFollow = 1;
}